package com.bosssoft.base.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页返回数据
 * @author Fang_Sir
 * @date 2021-04-14
 */
@Getter
@Setter
public class PaginationData<T> {
    private long total;
    private long current;
    private List<T> list;

    public PaginationData(){
        this.total = 0;
        this.current = 1;
        this.list = new ArrayList<>();
    }

    public PaginationData(long current, long total, List<T> list){
        this.total = total;
        this.current = current;
        this.list = list;
    }

    public PaginationData(IPage<T> data){
        this(data.getCurrent(), data.getTotal(), data.getRecords());
    }

}
